const OPTIONS = {
  duration: 200,
  timingFunction: 'linear',
  delay: 0,
  transformOrigin: '50% 50% 0'
}

const animationFunc = (opts = {}) =>
  wx.createAnimation({
    ...OPTIONS,
    ...opts
  });
/**=====================
 *        scale
 =====================*/
const _SCALE_IN_FROM = animationFunc({
  duration: 0
})
  .opacity(0)
  .scale(1.185)
  .step()
  .export()

const _SCALE_IN_TO = animationFunc()
  .opacity(1)
  .scale(1)
  .step()
  .export()

const _SCALE_OUT_FROM = animationFunc()
  .opacity(0)
  .scale(0.85)
  .step()
  .export()

const _SCALE_OUT_TO = animationFunc({
  duration: 20,
})
  .opacity(0)
  .scale(1.185)
  .step()
  .export()

/**=====================
 *        fade
 =====================*/
const _FADE_IN_FROM = animationFunc({
  duration: 0
})
  .opacity(0)
  .step()
  .export()

const _FADE_IN_TO = animationFunc()
  .opacity(1)
  .step()
  .export()

const _FADE_OUT_FROM = animationFunc()
  .opacity(0)
  .step()
  .export()

const _FADE_OUT_TO = animationFunc({
  duration: 20
})
  .opacity(0)
  .step()
  .export()

export {
  _SCALE_IN_FROM,
  _SCALE_IN_TO,
  _SCALE_OUT_FROM,
  _SCALE_OUT_TO,
  _FADE_IN_FROM,
  _FADE_IN_TO,
  _FADE_OUT_FROM,
  _FADE_OUT_TO
}